package com.alibaba.csp.sentinel.demo;

import com.alibaba.csp.sentinel.Entry;
import com.alibaba.csp.sentinel.SphU;
import com.alibaba.csp.sentinel.context.Context;
import com.alibaba.csp.sentinel.context.ContextUtil;
import com.alibaba.csp.sentinel.demo.callback.MyCallback;
import com.alibaba.csp.sentinel.node.DefaultNode;
import com.alibaba.csp.sentinel.node.StatisticNode;
import com.alibaba.csp.sentinel.slots.block.BlockException;
import com.alibaba.csp.sentinel.slots.statistic.StatisticSlotCallbackRegistry;

/**
 * @author mawei
 * @date 2020/11/24
 */
public class FirstDemo {
    public static void main(String[] args) {
        try {
            Entry en= SphU.entry("ABC");
            System.out.println(ContextUtil.getContext().getCurNode().passQps());
            en.exit();
            ContextUtil.enter("myContext");
            SphU.entry("ABC");
            System.out.println(ContextUtil.getContext().getCurNode().passQps());
            System.out.println(((DefaultNode) ContextUtil.getContext().getCurNode()).getClusterNode().passQps());

        } catch (BlockException e) {
            e.printStackTrace();
        }

    }
}
